package com.cskaoyan.day1.generic5;

/**
 * @author Common-zhou
 * @since 2023-02-27 11:32
 */
public interface Player<T, R> {
    R play(T data);
}

class ChildPlayer implements Player<String, Integer> {
    @Override
    public Integer play(String data) {
        return null;
    }
}


// 在什么时候能指定它的类型呢？
// 实现接口的时候，没有指定类型。则泛型的类型为默认的Object
class YoungPlayer implements Player {
    @Override
    public Object play(Object data) {
        return null;
    }
}

// String Integer
class OldPlayer<K, V> implements Player<K, V> {

    @Override
    public V play(K data) {
        return null;
    }
}
